﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Rabbit.Domain.Slaughter;
using Rabbit.Service;

namespace Rabbit.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SlaughterController : ControllerBase
    {

        SlaughterService res;

        public SlaughterController(SlaughterService res)
        {
            this.res = res;
        }

        #region 屠宰信息

        /// <summary>
        /// 屠宰信息
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSlaughter(int tmid)
        {
            return Ok(res.GetSlaughter(tmid));
        }
        /// <summary>
        /// 添加或修改屠宰信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddSlaughter(SlaughterInfo input)
        {
            return Ok(res.AddSlaughter(input));
        }





        #endregion


        #region 相关资质

        /// <summary>
        /// 添加相关资质
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddSlaughterImg(SlaughterImg input)
        {
            return Ok(res.AddSlaughterImg(input));
        }
        /// <summary>
        /// 图片相关资质
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSlaughterImg(int tmid)
        {
            return Ok(res.GetSlaughterImg(tmid));
        }
        /// <summary>
        /// 删除相关资质图片
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult DelSlaughterImg(int ids)
        {
            return Ok(res.DelSlaughterImg(ids));
        }

        #endregion

        #region 企业信息

        /// <summary>
        /// 企业信息
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSlaughterQY(int tmid)
        {
            return Ok(res.GetSlaughterQY(tmid));
        }
        /// <summary>
        /// 添加或修改企业信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddSlaughterQY(SlaughterQY input)
        {
            return Ok(res.AddSlaughterQY(input));
        }
        /// <summary>
        /// 省
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProvince()
        {
            return Ok(res.GetProvince());
        }
        /// <summary>
        /// 市
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetCity(int pid)
        {
            return Ok(res.GetCity(pid));
        }
        /// <summary>
        /// 县
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetCounty(int cid)
        {
            return Ok(res.GetCounty(cid));
        }




        #endregion


        #region 屠宰企业图片

        /// <summary>
        /// 添加企业图片
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddSlaughterImg2(SlaughterImg input)
        {
            return Ok(res.AddSlaughterImg2(input));
        }
        /// <summary>
        /// 企业图片
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSlaughterImg2(int tmid)
        {
            return Ok(res.GetSlaughterImg2(tmid));
        }
        /// <summary>
        /// 删除企业图片
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult DelSlaughterImg2(int ids)
        {
            return Ok(res.DelSlaughterImg2(ids));
        }

        #endregion




    }
}
